/**
 * Created by chenhm on 11/04/2017.
 */
const fs = require('fs');

const walkFile = function (pathResolve, mime) {
    let files = fs.readdirSync(pathResolve),
        fileList = {};

    for(let[i, item] of files.entries()){
        let itemArr = item.split('\.'),
            itemMime = (itemArr.length > 1) ? itemArr[itemArr.length - 1] : 'undefined',
            keyName = item + '';
        if(mime === itemMime){
            fileList[item] = pathResolve + item;
        }
    }

    return fileList;
};

module.exports = walkFile;